/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JdialogPropriedades.java
 *
 * Created on 12/Jan/2012, 1:14:22
 */
package gardenmaker;

/**
 *
 * @author Leonardo Lino
 */
public class JdialogPropriedades extends javax.swing.JDialog {
    
    Projeto projeto;
    Forma forma;

    /** Creates new form JdialogPropriedades */
    public JdialogPropriedades(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        projeto=null;
    }
    
    public void setForma(Forma forma){
        this.forma = forma;
    }
    
    public void setProjeto(Projeto projeto){
        this.projeto = projeto;
    }
    
    public void setTHeight(int i) {
        String s;
        s = Integer.toString(i);
        tHeight.setText(s);
    }
    
    public void setEnableAltura(boolean enable){
        tHeight.setEnabled(enable);
    }
    
    public void setEnableLargura(boolean enable){
        tWidth.setEnabled(enable);
    }

    public String getTRotation() {
        return tRotation.getText();
    }

    public void setTRoation(int i) {
        String s;
        s = Integer.toString(i);
        tRotation.setText(s);
    }

    public String getTHeight() {
        return tHeight.getText();
    }

   
     public void setTWidth(int i){
        String s;
        s= Integer.toString(i);
        tWidth.setText(s);
    }
    
    public String getTWidth(){
        return tWidth.getText();
    }
    
    public void setTName(String s){
        jtNome.setText(s);
    }
    
    

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jSave = new javax.swing.JButton();
        jtNome = new javax.swing.JTextField();
        tHeight = new javax.swing.JTextField();
        tWidth = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        tRotation = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Properties");
        setModalityType(java.awt.Dialog.ModalityType.TOOLKIT_MODAL);

        jLabel1.setText("Nome");

        jLabel2.setText("Height");

        jLabel3.setText("Width");

        jSave.setText("Save");
        jSave.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jSaveMousePressed(evt);
            }
        });

        jtNome.setText("jTextField1");

        tHeight.setText("0");

        tWidth.setText("0");

        jLabel4.setText("rotation");

        tRotation.setText("0");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSave, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel4)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(jLabel2)
                            .addComponent(jLabel3))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(tHeight, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(tRotation, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(tWidth, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE))
                                .addGap(24, 24, 24))
                            .addComponent(jtNome, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE))))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jtNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tHeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addGap(12, 12, 12)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tWidth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(tRotation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 51, Short.MAX_VALUE)
                .addComponent(jSave)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jSaveMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jSaveMousePressed
        int i;
        String s;
        i = Integer.parseInt( tHeight.getText() );
        forma.setAltura(i);
        
        i = Integer.parseInt( tWidth.getText() );
        forma.setLargura(i);
        
         i = Integer.parseInt( tRotation.getText() );
         forma.setRotacao(i);
         
         s= jtNome.getText();
         forma.setName(s);
        
    }//GEN-LAST:event_jSaveMousePressed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(JdialogPropriedades.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(JdialogPropriedades.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(JdialogPropriedades.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(JdialogPropriedades.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                JdialogPropriedades dialog = new JdialogPropriedades(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {

                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JButton jSave;
    private javax.swing.JTextField jtNome;
    private javax.swing.JTextField tHeight;
    private javax.swing.JTextField tRotation;
    private javax.swing.JTextField tWidth;
    // End of variables declaration//GEN-END:variables
}
